<link rel="stylesheet" type="text/css" href="<?php echo $this->_baseUrl;?>/public/css/admin.css"/>
<div id="toolbar" >
  <div class="right-toolbar">
  <a title="Thêm máy ảo mới">
  <button onclick="location.href='<?php echo $this->_baseUrl;?>/vm/create'">
  <img src="<?php echo $this->_baseUrl;?>/public/images/web/insert.png" height="32px" width="32px"/>
  <span><p>Thêm mới</p></span>
  </button>
  </a>
  </div>
  <div class="left-toolbar">
  <img src="<?php echo $this->_baseUrl;?>/public/images/web/vmware.png" height="48px" width="48px"/>
  <span>Quản lý máy ảo</span>
  </div>
</div>

<div id="box-content">
 <div id="box-content1">
    <div id="box-content-top">
          
               <div class="filter" style="margin-left: 50px; border-style: none;">
                    <span style="padding-right: 15px; font-weight: bold;">Trạng thái</span>
                    <select id="filter_status" name="filter_status" class="styled"> 
					<option value="2" <?php if($this->input_status == 2) echo "selected='selected'";?>>Tất cả</option> 
					<option value="1" <?php if($this->input_status == 1) echo "selected='selected'";?>>Đang chạy</option> 
					<option value="0" <?php if($this->input_status == 0) echo "selected='selected'";?>>Đang tắt</option> 
				    </select>
				    
				     <script type="text/javascript">
					    	$(document).ready(function(){
					         	 function loadStatus(value){
					         		 if(value == 0)
					         			location.href='<?php echo $this->_baseUrl;?>/vm/status/stop';
					         		  else
					         			 if(value == 1)
							         			location.href='<?php echo $this->_baseUrl;?>/vm/status/start';
							         			else
									         			location.href='<?php echo $this->_baseUrl;?>/vm'; 
							      }
					             $('#filter_status').change(function() {
					            	  loadStatus($(this).val());
					            	});
					   		 });

					    	function clickVm(id,type){
					    		if(type == 0){
					    			$('html, body').animate({ scrollTop: 0 }, 'slow');
					    			$('.loading').show();
					    			location.href='<?php echo $this->_baseUrl;?>/vm/stop/id/'+id;
					    		}
					    		else
					    		{
					    			$('html, body').animate({ scrollTop: 0 }, 'slow');
					    			$('.loading').show();
					    			location.href='<?php echo $this->_baseUrl;?>/vm/start/id/'+id;
					    		}
					    	}	 
					  </script>
				    
               </div>    
    </div>
 
    
    <div class = "paging">
   </div> 
   
   <script type="text/javascript">
   $(document).ready(function(){
	  loadPage();
	  setInterval("loadPage()",250);
	});

      var lasturl="p";
  	  function loadContent(page){
   		 $('.paging').load("<?php echo $this->_baseUrl;?>/vm/paging/s/<?php echo $this->status;?>/p/"+page);
	  }
	  
	  function loadPage(){
		  hash = window.location.hash;
		  if(hash != lasturl)    
		    {
		        lasturl=hash;
		        page = 1;
				if(hash != ""){
				  	  hash = hash.replace('#p','');
				  	  hash = hash.replace('#','');
				  	  page = hash; 
				}
				loadContent(page);
		    }
	  }
   </script>
   
     
 
 </div>
</div>
